Service class documentation

class nlp_architect.server.service.Service(service_name)[source]

Handles loading and inference using specific models

get_paragraphs()[source]
get_service_inference(docs, headers)[source]

get parser response from service API

Parameters:
  • headers (list(str)) – the headers of the request
  • docs – input received from the request
Returns:

the service API output

load_service(name)[source]

Initialize and load service from input given name, using “services.json” properties file

Parameters:name (str) – The name of service to upload using server
Returns:The loaded service
class nlp_architect.common.core_nlp_doc.CoreNLPDoc[source]

Object for core-components (POS, Dependency Relations, etc).

Parameters:
  • self.doc_text (str) – the doc text
  • self.sentences (list(list(dict))) – list of sentences, each word in a sentence is represented in a dict, structured as follows: {‘start’: (int), ‘len’: (int), ‘pos’: (str), ‘ner’: (str), ‘lemma’: (str), ‘gov’: (int), ‘rel’: (str)}
brat_doc()[source]

Return doc adapted to BRAT expected input

displacy_doc()[source]

Return doc adapted to displacyENT expected input

json()[source]

Return json representations of the object

Returns:json representations of the object
Return type:json
pretty_json()[source]

Return pretty json representations of the object

Returns:pretty json representations of the object
Return type:json
class nlp_architect.common.high_level_doc.HighLevelDoc[source]

object for annotation documents

Parameters:
  • self.doc_text (str) – document text
  • self.annotation_set (list(str)) – list of all annotations in doc
  • self.spans (list(dict)) – list of span dict, each span_dict is structured as follows: { ‘end’: (int), ‘start’: (int), ‘type’: (str) string of annotation }
displacy_doc()[source]

Return doc adapted to displacyENT expected input

json()[source]

Return json representations of the object

Returns:json representations of the object
Return type:json
pretty_json()[source]

Return pretty json representations of the object

Returns:pretty json representations of the object
Return type:json